home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK2.toast / Development Kits (Disc 2) / QuickDraw GX / Programming Stuff / GX Libraries / ShapeControlsLibrary.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-31  |  4.4 KB  |  96 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        ShapeControlsLibrary.h
  3.     
  4.     Contains:    library to allow the user to manipulate (gxTransform) a set of shapes
  5.     
  6.     Written By:    Dave Good and Jeff Kreegar
  7.     
  8.     Copyright:    ©1992-1995 by Apple Computer, Inc.  All rights reserved.
  9.     
  10.     Change History (most recent first):
  11.     
  12.          <2>      1/9/95    JD        changed 'boolean' to 'Boolean'
  13.          <1>      1/9/95    JD        First checked in.
  14.  
  15. */
  16.  
  17. #ifndef __SHAPECONTROLSLIBRARY__
  18. #define __SHAPECONTROLSLIBRARY__
  19.  
  20. #include <Events.h>
  21. #include <GXTypes.h>
  22.  
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26.  
  27. /* for compatibility with old headers */
  28. #define shapeControlsLibraryIncludes
  29.  
  30. /*
  31. |   General Information:
  32. |
  33. |   • The items gxShape passed in is used directly by the gxShape controls library; the application may modify or
  34. |      look at it at any time. Note that if the application removes or adds a sub-gxShape (or changes a sub-gxShape
  35. |      in any way) then it needs to call InvalidShapeControlShape on the sub-gxShape.
  36. |
  37. |   • The foreground and background shapes are also used directly by the gxShape controls library and therefore
  38. |      can be modified at any time (and also must be invalidated). The background gxShape appears underneath all
  39. |      the items and the foreground gxShape appears above all the items, but below the control handles for the
  40. |      current selection.
  41. |
  42. |   • The foreground and background shapes will both be modified slightly to draw to the same list of viewPorts
  43. |      that the items picture goes to. Other than this, they will not be changed.
  44. |
  45. |   • GetShapeControlSelection and SetShapeControlSelection do NOT work directly with the selection picture
  46. |      inside the gxShape control; instead GetShapeControlSelection returns a completely new picture that contains
  47. |      all the sub-shapes of the item picture that are selected. The application must then dispose of this returned
  48. |      picture when it is through with it. SetShapeControlSelection will select all the sub-shapes of the items
  49. |      picture contained by shapesToSelect. The application may then dispose of this shapesToSelect picture. The
  50. |      shapesToSelect parameter may be a single sub-gxShape instead of a picture, but it must always be contained
  51. |      by the items picture.
  52. |
  53. |   • GetShapeControlSelectionHandles returns a copy of the gxShape that is drawn as the selection’s handles.
  54. |
  55. |   • SendEventToShapeControl returns true if it handled the event and false if it didn’t. The events handled are:
  56. |       * keyDown: delete removes the item
  57. |       * mouseDown: in a destination gxViewPort for the items picture, the selection will be tracked; any other
  58. |          mouse event will return false.
  59. |
  60. |   • InvalidateShapeControlShape does NOT require that invalidShape be a member of the items picture for the
  61. |      gxShape control. However, if invalidShape is a member and it is selected, then the control handles will be
  62. |      added to the invalid area also. An application should use this call when invalidating a picture containly
  63. |      several widely separated disjoint areas; it should probably use InvalidateShapeControlRectangle to invalidate
  64. |      other types of shapes.
  65. |
  66. |   • UpdateShapeControl redraws all the invalid areas that have been recorded by calls to InvalidateShapeControlShape
  67. |      and InvalidateShapeControlRectangle.
  68. |
  69. |   • The gxShape controls library will try to allocate an offscreen buffer for each of the viewPorts that the items
  70. |      picture draws into. If this buffer is allocated, then the manipulation of the sub-objects will be flicker-free.
  71. |      If, on the other hand, there is not enough memory to allocate this buffer, then the gxShape controls library
  72. |      will still work, but the objects will flicker quite a bit as they are manipulated.
  73. */
  74.  
  75. typedef struct shapeControlRecord **shapeControl;
  76.  
  77. shapeControl NewShapeControl(gxShape items, gxShape background, gxShape foreground);
  78. void DisposeShapeControl(shapeControl target);
  79.  
  80. gxShape GetShapeControlSelection(const shapeControl source);
  81. void SetShapeControlsSelection(shapeControl target, gxShape shapesToSelect, Boolean bringToFront, Boolean replaceSelection);
  82. gxShape GetShapeControlSelectionHandles(const shapeControl source);
  83.  
  84. Boolean SendEventToShapeControl(shapeControl target, EventRecord *event);
  85.  
  86. void InvalidateShapeControlShape(shapeControl target, gxShape invalidShape);
  87. void InvalidateShapeControlRectangle(shapeControl target, gxRectangle *bounds);
  88.  
  89. void UpdateShapeControl(shapeControl target);
  90.  
  91. #ifdef __cplusplus
  92. }
  93. #endif
  94.  
  95. #endif  /* __SHAPECONTROLSLIBRARY__ */
  96.